package pri.syl.xiaowu.websocket.netty.server.thread;

import lombok.Getter;
import lombok.Setter;

/**
 * @Author YunLong
 * @Date 2021/7/18 19:28
 * @Description  初始化业务线程
 **/
@Getter
@Setter
public abstract class AbstractWebsocketServerInitThread implements Runnable {
    private String url;
    private int websocketMaxFramePayloadLength;
    private int websocketReadTimeoutMilli;

    public AbstractWebsocketServerInitThread(String url, int websocketMaxFramePayloadLength, int websocketReadTimeoutMilli) {
        this.url = url;
        this.websocketMaxFramePayloadLength = websocketMaxFramePayloadLength;
        this.websocketReadTimeoutMilli = websocketReadTimeoutMilli;
    }

    /**
     * init
     *
     * @param url                            url
     * @param websocketMaxFramePayloadLength websocketMaxFramePayloadLength
     * @param websocketReadTimeoutMilli      websocketReadTimeoutMilli
     */
    protected abstract void init(String url, int websocketMaxFramePayloadLength, int websocketReadTimeoutMilli);

    @Override
    public void run() {
        init (this.url,
                this.websocketMaxFramePayloadLength,
                this.websocketReadTimeoutMilli);
    }
}
